package cc.comac.mom.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipReqularCheckService;
import cc.comac.mom.bean.EquipReqularCheck;
import cc.comac.mom.bean.EquipReqularCheckBean;
import cc.comac.mom.bean.EquipReqularCheckSelectBean;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value ="/EquipReqularCheck")
public class EquipReqularCheckController {
	
	@Autowired
	private EquipReqularCheckService equipReqularCheckService;
	@RequestMapping(value = "/save",method = RequestMethod.POST)
	public ResultBean save(@RequestBody EquipReqularCheckBean obj) {
			ResultBean resultBean = equipReqularCheckService.save(obj);
		
		return resultBean;
	}
	
	@RequestMapping(value = "/update",method = RequestMethod.POST)
	public ResultBean update(@RequestBody EquipReqularCheck obj) {
		
		return equipReqularCheckService.update(obj);
		
	}
	
	@RequestMapping(value = "/deleteBatch",method = RequestMethod.POST)
	public ResultBean delete(@RequestBody EquipReqularCheckBean obj) {
	
			ResultBean resultBean = equipReqularCheckService.deleteBatch(obj);
		return resultBean;
		
	}
	
	@RequestMapping("/getById")
	public EquipReqularCheck getById(@RequestBody EquipReqularCheck obj) {
		EquipReqularCheck equipReqularCheckList = equipReqularCheckService.getById(obj);
		return equipReqularCheckList;
		
	}
	
	@RequestMapping("/selectByFields")
	public ResultBean selectByFields(@RequestBody EquipReqularCheckSelectBean obj) {
		ResultBean resultBean = new ResultBean(true);
		ResultDev resultDev = equipReqularCheckService.selectByFields(obj);
		resultBean.setObject(resultDev);
		return resultBean;
		
	}
	
	@RequestMapping("/selectByCondition")
	public EquipReqularCheckBean selectByCondition(@RequestBody EquipReqularCheck obj) {
		return equipReqularCheckService.selectByCondition(obj);
		
	}
	
	@ApiOperation("定检生效/失效")
	@RequestMapping("/disableEquipReqularCheck")
	public ResultBean disableEquipReqularCheck(@RequestBody EquipReqularCheckBean obj) {
		return equipReqularCheckService.disableEquipReqularCheck(obj);
		
	}
	
	@ApiOperation("定检计划通过位置过滤定检准则信息")
	@RequestMapping("/selectByWorkShop")
	public ResultBean selectByWorkShop(@RequestBody EquipReqularCheckSelectBean obj) {
		return equipReqularCheckService.selectByWorkShop(obj);
	}
}
